﻿
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<form id="form1">
    <div class="container" style="margin-top: 10px; margin-left: -4%; ">
        <div class="tab-content">
            <div role="tabpanel" style="margin-top: 10px; margin-left: 48px; margin-right: 105px;" id="basicInfo">
                <table class="form">
                    <tr>
                        <th class="formTitle">初复诊：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-7">
                                    <label><input type="radio" name="fzbz" class="optionsRadios formClearIgnore" value="0" data-label="初诊" />初诊</label>
                                    <label><input type="radio" name="fzbz" class="optionsRadios formClearIgnore" value="1" data-label="复诊" />复诊</label>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">身高：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-7">
                                    <input id="shengao" name="shengao" type="text" class="form-control form-an" />
                                </div>
                                <div class="col-md-5">
                                    <label>cm</label>
                                </div>
                            </div>
                        </td>
                        <th class="formTitle">体重：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-7">
                                    <input id="Id" name="Id" type="text" hidden />
                                    <input id="mzh" name="mzh" type="text" hidden />
                                    <input id="tizhong" name="tizhong" type="text" class="form-control form-an" />
                                </div>
                                <div class="col-md-5">
                                    <label>kg</label>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">体温：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-7">
                                    <input id="tiwen" name="tiwen" type="text" class="form-control form-an" />
                                </div>
                                <div class="col-md-5">
                                    <label>℃</label>
                                </div>
                            </div>
                        </td>
                        <th class="formTitle">脉搏：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-7">
                                    <input id="maibo" name="maibo" type="text" class="form-control form-an" />
                                </div>
                                <div class="col-md-5">
                                    <label>次/min</label>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">呼吸：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-7">
                                    <input id="huxi" name="huxi" type="text" class="form-control form-an" />
                                </div>
                                <div class="col-md-5">
                                    <label>次/min</label>
                                </div>
                            </div>
                        </td>
                        <th class="formTitle">收缩压：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-8">
                                    <input id="shousuoya" name="shousuoya" type="text" class="form-control form-an" />
                                </div>
                                <div class="col-md-4">
                                    <label style="width:2%;">mmHg</label>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">舒张压：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-8">
                                    <input id="shuzhangya" name="shuzhangya" type="text" class="form-control form-an" />
                                </div>
                                <div class="col-md-4">
                                    <label style="width:2%;">mmHg</label>
                                </div>
                            </div>
                        </td>
                        <th class="formTitle">血糖(方式)：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-8">
                                    <select id="xuetangclfs" name="xuetangclfs" class="vitalsignschange">
                                        <option value="">=请选择=</option>
                                    </select>
                                </div>
                            </div>
                        </td>
                    </tr>
                    @*<tr>
            <th class="formTitle">血压：</th>
            <td class="formValue">
                <div class="row">
                    <div class="col-md-8">
                        <input id="xueya" name="xueya" type="text" class="form-control form-an" />
                    </div>
                    <div class="col-md-4">
                        <label style="width:2%;">mmHg</label>
                    </div>
                </div>
            </td>
        </tr>*@
                    <tr>
                        <th class="formTitle">血糖(值)：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-8">
                                    <input id="xuetang" name="xuetang" type="text" class="form-control form-an" />
                                </div>
                                <div class="col-md-4">
                                    <label style="width:2%;">mmol/L</label>
                                </div>
                            </div>
                        </td>
                        <th class="formTitle">婚姻：</th>
                        <td class="formValue">
                            <div class="row">
                                <div class="col-md-8">
                                    <select id="hy" name="hy" class="form-control">
                                        <option value="">=请选择=</option>
                                        <option value="1">未婚</option>
                                        <option value="2">已婚</option>
                                        <option value="3">不详</option>
                                    </select>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</form>

<script>
    var mzh = $.request("mzh");
    $('#mzh').val(mzh);
    $(function () {
        $('#xuetangclfs').itemDetailsBindSelect({ itemtype: "xuetangclfs" });
        if (!!mzh) {
            $.najax({
                url: "/PatientList/GetFormJson",
                data: { mzh: mzh },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data)
                    if (data.fzbz == "1") {
                        $("input[name='fzbz'][value='0']").prop('checked', false);
                        $("input[name='fzbz'][value='1']").prop('checked', true);
                    } else {
                        $("input[name='fzbz'][value='1']").prop('checked', false);
                        $("input[name='fzbz'][value='0']").prop('checked', true);
                    }
                }
            });
        }
        
    });
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        var keyValue = "";
        if ($('#Id').val()) {
            keyValue = $('#Id').val();
        }
        var data = $('#form1').formSerialize();
        data.fzbz = $('input[name="fzbz"]:checked').val()
        $.submitForm({
            url: "/PatientList/SubmitForm?keyValue=" + keyValue,
            param: data,
            success: function () {
            }
        })
    }
</script>